﻿@model BrnMall.Web.StoreAdmin.Models.StoreModel

@section header{
    <title>店铺信息</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <link type="text/css" rel="stylesheet" href="/components/umeditor/themes/default/css/umeditor.css">
    <script type="text/javascript" src="/components/umeditor/umeditor.config.js?v=1"></script>
    <script type="text/javascript" src="/components/umeditor/umeditor.js"></script>
    <script type="text/javascript" src="/components/umeditor/lang/zh-cn/zh-cn.js"></script>
    <link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/region.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/product.js"></script>
    <script type="text/javascript">
        provinceId = @ViewData["provinceId"]; //省id
        cityId = @ViewData["cityId"]; //市id
        countyId = @ViewData["countyId"]; //县或区id

        $(function () {
            //logo
            var logoUploader = WebUploader.create({
                pick: '.uploadLogoBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadstorelogo',
                fileVal: 'upload',
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
                });

            logoUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadLogoPreview").html("上传中...");
            });
            
            logoUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadLogoPreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadLogoPreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadLogoPreview").html('图片太大');
                else {
                    $(".uploadLogoPreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/logo/source/" + data + "\"  />");
                    $("#Logo").val(data);
                }
            });

            logoUploader.on('uploadError', function(file) {
                $(".uploadLogoPreview").html("上传失败");
            });

            //小程序二维码
            var WeApp_QrcodeUploader = WebUploader.create({
                pick: '.uploadWeApp_QrcodeBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadstoreWeAppCode',
                fileVal: 'upload',
                width:50,
                height:50,
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
                });

            WeApp_QrcodeUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadWeApp_QrcodePreview").html("上传中...");
            });

            WeApp_QrcodeUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadWeApp_QrcodePreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadWeApp_QrcodePreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadWeApp_QrcodePreview").html('图片太大');
                else {
                    $(".uploadWeApp_QrcodePreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/weapp/" + data + "\"  />");
                    $("#WeApp_Qrcode").val(data);
                }
            });

            WeApp_QrcodeUploader.on('uploadError', function(file) {
                $(".uploadWeApp_QrcodePreview").html("上传失败");
            });

            //订阅宝二维码
            var WeService_QrcodeUploader = WebUploader.create({
                pick: '.uploadWeService_QrcodeBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadstoreWeServiceCode',
                fileVal: 'upload',
                width:50,
                height:50,
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
                });

            WeService_QrcodeUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadWeService_QrcodePreview").html("上传中...");
            });

            WeService_QrcodeUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadWeService_QrcodePreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadWeService_QrcodePreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadWeService_QrcodePreview").html('图片太大');
                else {
                    $(".uploadWeService_QrcodePreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/weservice/" + data + "\"  />");
                    $("#WeService_Qrcode").val(data);
                }
            });

            WeService_QrcodeUploader.on('uploadError', function(file) {
                $(".uploadWeService_QrcodePreview").html("上传失败");
            });

            //首页logo
            var bannerUploader = WebUploader.create({
                pick: '.uploadBannerBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadstorebanner',
                fileVal: 'upload',
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
                });

            bannerUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadBannerPreview").html("上传中...");
            });

            bannerUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadBannerPreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadBannerPreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadBannerPreview").html('图片太大');
                else {
                    $(".uploadBannerPreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/banner/" + data + "\"  />");
                    $("#Banner").val(data);
                }
            });

            bannerUploader.on('uploadError', function(file) {
                $(".uploadBannerPreview").html("上传失败");
            });
        });
    </script>
    <style type="text/css">
        .uploadBut .cancel, .uploadBut .fileName, .uploadBut .data, .uploadBut .uploadify-progress {
            display: none;
        }
    </style>
}

@section body{
    <h1 class="rightH1">
        微信小程序 > 店铺管理 > <span class="rightH1-cur">店铺信息</span>
        <div class="right">
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>

    @using (Html.BeginForm())
    {
        @Html.HiddenFor(x => x.SupportPhone)
        @Html.HiddenFor(x => x.SupportCompany)
        <div class="addTable">
            <table width="100%">
                <tr>
                    <td style="width:140px" align="right">店铺Id：</td>
                    <td>@WorkContext.StoreId</td>
                </tr>
                @if (Model.StorePid > 0)
                {
                    <tr>
                        <td style="width:140px" align="right">平台Id：</td>
                        <td>@Html.TextBoxFor(x => x.StorePid, new { @class = "input", size = "15" })@Html.ValidationMessageFor(x => x.StorePid) <label>修改平台ID前需要跟对应的平台商确认！切勿随便更改！</label></td>
                    </tr>
                }
                <tr>
                    <td width="80px" align="right">店铺名称：</td>
                    <td>@Html.TextBoxFor(x => x.StoreName, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.StoreName)</td>
                </tr>
                <tr>
                    <td align="right">Logo：</td>
                    <td>
                        <div class="upload">
                            <div class="uploadPreview uploadLogoPreview">
                                @if (!string.IsNullOrEmpty(Model.Logo))
                                {
                                    <img src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/logo/source/@Model.Logo" />
                                }
                                else
                                {
                                    @:暂无图片
                        }
                            </div>
                            <div class="left">
                                <div class="uploadProgressBar"></div>
                                <div class="uploadBut uploadLogoBut">选择图片,图片尺寸170*50</div>
                            </div>
                            <div class="clear"></div>
                        </div>
                        @Html.TextBoxFor(x => x.Logo, new { @class = "hide" })
                        @Html.ValidationMessageFor(x => x.Logo)
                        <br />
                    </td>
                </tr>

                <tr>
                    <td align="right">首页Logo：</td>
                    <td>
                        <div class="upload">
                            <div class="uploadPreview uploadBannerPreview">
                                @if (!string.IsNullOrEmpty(Model.Banner))
                                {
                                    <img src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/banner/@Model.Banner" />
                                }
                                else
                                {
                                    @:暂无图片
                        }

                            </div>

                            <div class="left">
                                <div class="uploadProgressBar"></div>
                                <div class="uploadBut uploadBannerBut">选择图片,图片尺寸800x130</div>
                            </div>
                            <div class="clear"></div>
                            <span>
                                @if (!string.IsNullOrEmpty(Model.Banner))
                                {
                                    <a href="@Url.Action("ClearStoreBanner", new {storeId = WorkContext.StoreId})" class="editOperate">[删除图片]</a>
                                }
                            </span>
                        </div>
                        @Html.TextBoxFor(x => x.Banner, new { @class = "hide" })
                        @Html.ValidationMessageFor(x => x.Banner)
                    </td>
                </tr>
                <tr>
                    <td align="right">店铺行业：</td>
                    <td>
                        @Html.DropDownListFor(x => x.StoreIid, ViewData["storeIndustryList"] as List<SelectListItem>)@Html.ValidationMessageFor(x => x.StoreIid)
                    </td>
                </tr>

                <tr>
                    <td align="right">店铺主题：</td>
                    <td>
                        @Html.DropDownListFor(x => x.Theme, ViewData["themeList"] as List<SelectListItem>)@Html.ValidationMessageFor(x => x.Theme)
                    </td>
                </tr>

                <tr>
                    <td align="right">手机号：</td>
                    <td>@Html.TextBoxFor(x => x.Mobile, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Mobile)</td>
                </tr>

                <tr>
                    <td align="right">固定电话：</td>
                    <td>@Html.TextBoxFor(x => x.Phone, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Phone)</td>
                </tr>
                <tr>
                    <td align="right">微信号：</td>
                    <td>@Html.TextBoxFor(x => x.Fax, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Fax)</td>
                </tr>
                <tr>
                    <td align="right">腾讯QQ：</td>
                    <td>@Html.TextBoxFor(x => x.QQ, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.QQ)</td>
                </tr>

                <tr>
                    <td align="right">阿里旺旺：</td>
                    <td>@Html.TextBoxFor(x => x.WW, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.WW)</td>
                </tr>
                <tr>
                    <td align="right">视频地址：</td>
                    <td>@Html.TextAreaFor(x => x.VideoSrc, new { @class = "input", placeholder = "建议有自己服务器资源的客户填写", cols = "75", rows = "6" })@Html.ValidationMessageFor(x => x.VideoSrc)</td>
                </tr>
                <tr>
                    <td align="right">所在区域：</td>
                    <td>
                        <select class="provinceSelect" id="provinceSelect">
                            <option selected="selected" value="-1">请选择</option>
                        </select>
                        <select class="citySelect" id="citySelect">
                            <option selected="selected" value="-1">请选择</option>
                        </select>
                        <select class="countySelect" id="countySelect" name="regionid">
                            <option selected="selected" value="-1">请选择</option>
                        </select>
                        @Html.ValidationMessageFor(x => x.RegionId)
                    </td>
                </tr>
                <tr>
                    <td align="right">详细地址：</td>
                    <td>@Html.TextAreaFor(x => x.Address, new { cols = "40", rows = "6" })@Html.ValidationMessageFor(x => x.Address)</td>
                </tr>
                <tr>
                    <td align="right">经纬度坐标：</td>
                    <td>@Html.TextBoxFor(x => x.Location, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Location)&nbsp;&nbsp;<a class="editOperate" href="http://lbs.qq.com/tool/getpoint/" target="_blank">如何获取坐标？</a> </td>
                </tr>
                <tr>
                    <td align="right">店铺公告：</td>
                    <td>@Html.TextAreaFor(x => x.Announcement, new { cols = "40", rows = "6" })@Html.ValidationMessageFor(x => x.Announcement)</td>
                </tr>

                <tr>
                    <td align="right">店铺描述：</td>
                    <td>
                        <div style="margin-top: 5px;"></div>
                        <script name="Description" id="bmaEditor" type="text/plain">
                            @Html.Raw(Model.Description)
                        </script>
                        <script type="text/javascript">
                            window.UMEDITOR_CONFIG.imageUrl = "/storeadmin/tool/upload?operation=uploadproducteditorimage";
                            UM.getEditor('bmaEditor');
                        </script>
                        @*@Html.TextAreaFor(x => x.Description, new {cols = "40", rows = "6"})@Html.ValidationMessageFor(x => x.Description)*@
                    </td>
                </tr>

              
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>

        <div class="addTable" style="margin:10px; border-top: dashed 1px #ff8427;">
            <table width="100%">
                <tr>
                    <td style="width:130px" align="right">邮箱：</td>
                    <td>@Html.TextBoxFor(x => x.Email, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Email)</td>
                </tr>

                <tr>
                    <td align="right">小程序网站域名：</td>
                    <td>@Html.TextBoxFor(x => x.WebSite, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.WebSite)</td>
                </tr>
                <tr>
                    <td align="right">小程序网站二维码：</td>
                    <td>
                        <div class="upload">
                            <div class="uploadPreview uploadWeApp_QrcodePreview">
                                @if (!string.IsNullOrEmpty(Model.WeApp_Qrcode))
                                {
                                    <img src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/weapp/@Model.WeApp_Qrcode" />
                                }
                                else
                                {
                                    @:暂无图片
                        }
                            </div>
                            <div class="left">
                                <div class="uploadProgressBar"></div>
                                <div class="uploadBut uploadWeApp_QrcodeBut">选择图片,图片尺寸130x130</div>
                            </div>
                            <div class="clear"></div>
                        </div>
                        @Html.TextBoxFor(x => x.WeApp_Qrcode, new { @class = "hide" })
                        @Html.ValidationMessageFor(x => x.WeApp_Qrcode)
                        <br />
                    </td>
                </tr>
                <tr>
                    <td align="right">公众号二维码：</td>
                    <td>
                        <div class="upload">
                            <div class="uploadPreview uploadWeService_QrcodePreview">
                                @if (!string.IsNullOrEmpty(Model.WeService_Qrcode))
                                {
                                    <img src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/weservice/@Model.WeService_Qrcode" />
                                }
                                else
                                {
                                    @:暂无图片
                        }
                            </div>
                            <div class="left">
                                <div class="uploadProgressBar"></div>
                                <div class="uploadBut uploadWeService_QrcodeBut">选择图片,图片尺寸130x130</div>
                            </div>
                            <div class="clear"></div>
                        </div>
                        @Html.TextBoxFor(x => x.WeService_Qrcode, new { @class = "hide" })
                        @Html.ValidationMessageFor(x => x.WeService_Qrcode)
                        <br />
                    </td>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" id="sumbitBut" class="addBt submit">
                            <img src="/admin_store/images/submit.jpg" />
                        </a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
    }
}